import { RouteRecordRaw } from 'vue-router'
import RouterTransition from '@/components/transition/router-transition.vue'
import { DEFAULT_ROUTE } from '@/constants/base.contant'

// 基础路由

export const staticRouters: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'Layout',
    redirect: DEFAULT_ROUTE,
    component: () => import(/* webpackChunkName: "layout" */ '@/layout/index.vue'),
    children: [
      {
        path: '/dashboard',
        name: '/dashboard',
        component: () => import(/* webpackChunkName: "dashboard" */ '@/views/dashboard/home.vue'),
        meta: {
          title: '数据统计'
        }
      },
      {
        path: '/product',
        name: '/product',
        component: () => import(/* webpackChunkName: "product" */ '@/views/product/list.vue'),
        meta: {
          title: '产品列表'
        }
      },
      {
        path: '/user',
        name: '/user',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/list.vue'),
        meta: {
          title: '用户列表'
        }
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '@/views/login/login.vue'),
    meta: {
      title: '登录'
    }
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: '/error/404'
  },
  {
    path: '/error',
    name: 'error',
    component: RouterTransition,
    children: [
      {
        path: '404',
        name: 'error-404',
        meta: {
          title: '404'
        },
        component: () => import(/* webpackChunkName: "404" */ '@/views/shared/error/404.vue')
      },
      {
        path: '500',
        name: 'error-500',
        meta: {
          title: '500'
        },
        component: () => import(/* webpackChunkName: "500" */ '@/views/shared/error/500.vue')
      }
    ]
  }
]

export const whiteList = ['/login', '/error/404']
